package com.bdqn.springbootno1.config;

/* @Configuration   //spring配置文件
@EnableWebMvc    //相当于<mvc:annotation-driven/>
@ComponentScan(basePackages = {"com.bdqn.springbootno1.dao","com.bdqn.springbootno1.service","com.bdqn.springbootno1.controller"})   //替代xml文件中的扫描
public class AppConfig implements WebMvcConfigurer {

    //处理静态资源放行
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }
    //配置拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenIntercept()).addPathPatterns("/**").excludePathPatterns("/loginUser").excludePathPatterns("/upload/**");  //除了登录和静态资源不拦截，其它都拦截
    }


    //视图解析器
    @Bean
    public InternalResourceViewResolver internalResourceViewResolver(){
        InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
        internalResourceViewResolver.setPrefix("/");
        internalResourceViewResolver.setSuffix(".jsp");
        return internalResourceViewResolver;
    }
} */
